package prime.applogic;

import java.io.File;
import prime.pages.TestBase;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.ScreenshotException;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import prime.util.PropertyLoader;
import prime.util.Browser;
import prime.webdriver.WebDriverFactory;

public class ApplicationManagerTRServices {
	
	private MethodHelperTRServices metodHelperTRServices;
	private WebDriver driver;
	private String baseUrl;
	
	public ApplicationManagerTRServices() {
		baseUrl = PropertyLoader.loadProperty("site.url");
		String gridHubUrl = PropertyLoader.loadProperty("grid2.hub");
		
		Browser browser = new Browser();
		browser.setName(PropertyLoader.loadProperty("browser.name"));
		browser.setVersion(PropertyLoader.loadProperty("browser.version"));
		browser.setPlatform(PropertyLoader.loadProperty("browser.platform"));
		
		String username = PropertyLoader.loadProperty("user.username");
		String password = PropertyLoader.loadProperty("user.password");
		//FirefoxProfile profile = new ProfilesIni().getProfile("default"); 
		 //driver = new FirefoxDriver(profile);
		driver = WebDriverFactory.getInstance(gridHubUrl, browser, username, password);
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		
		metodHelperTRServices = new MethodHelperTRServices(this);
		
		
		//getNavigationHelper().openMainPage();
	}
	
	public MethodHelperTRServices getMetodHelperTRServices() {
		return metodHelperTRServices;
	}
	
	public WebDriver getWebDriver() {
		return driver;
	}

	public String getBaseUrl() {
		return baseUrl;
	}


}
